@Service
	public class SystemServiceImpl implements SystemService
	{
		@Resource
		private  SystemMapper  systemMapper;
		@Override
		public int insertSystem(SystemParam param){
			System system = new System();
			if(param.getSysCode() != null){
				system.setSysCode(param.getSysCode());
			}
			if(param.getWebUrl() != null){
				system.setWebUrl(param.getWebUrl());
			}
			if(param.getSysName() != null){
				system.setSysName(param.getSysName());
			}
			if(param.getDescription() != null){
				system.setDescription(param.getDescription());
			}
			if(param.getIconUrl() != null){
				system.setIconUrl(param.getIconUrl());
			}
			if(param.getCreateTime() != 0){
				system.setCreateTime(param.getCreateTime());
			}
			if(param.getUpdateTime() != 0){
				system.setUpdateTime(param.getUpdateTime());
			}
			 return systemMapper.insertSelective(system);
		}
		@Override
		public int updateSystem(SystemEditParam param){
			System system = new System();
			if(param.getSystemId() != null){
				system = getSystem(Long.parseLong(param.getSystemId()));
			}
			if(system == null){
				return 0;
			}
			if(param.getSysCode() != null){
				system.setSysCode(param.getSysCode());
			}
			if(param.getWebUrl() != null){
				system.setWebUrl(param.getWebUrl());
			}
			if(param.getSysName() != null){
				system.setSysName(param.getSysName());
			}
			if(param.getDescription() != null){
				system.setDescription(param.getDescription());
			}
			if(param.getIconUrl() != null){
				system.setIconUrl(param.getIconUrl());
			}
			if(param.getCreateTime() != 0){
				system.setCreateTime(param.getCreateTime());
			}
			if(param.getUpdateTime() != 0){
				system.setUpdateTime(param.getUpdateTime());
			}
			 return systemMapper.updateByPrimaryKeySelective(system);
		}
		@Override
		public int deleteSystem(long id){
			System system = getSystem(id);
			if(system == null){
				return 0;
			}
			return systemMapper.deleteByPrimaryKey(id);
		}
		@Override
		public System getSystem(long id){
			 return systemMapper.selectByPrimaryKey(id);
		}
		@Override
		public int deleteSystemList(String ids){
			List<String> systemList = Arrays.asList(ids.split(","));
			int count = 0;
			for (String id : systemList) {
			count = count + deleteSystem(Long.parseLong(id));
		}
			if( count == systemList.size()){
			return 1;
			}else{
			return 0;
			}
	}
		@Override
		public List<System> selectSystem(SystemSelectParam param){
			SystemExample systemExample = new SystemExample();
			systemExample.setOrderByClause("create_time desc");
			SystemExample.Criteria criteria = systemExample.createCriteria();
			if(param.getSysCode() != null){
				criteria.andSysCodeEqualTo(param.getSysCode());
			}
			if(param.getWebUrl() != null){
				criteria.andWebUrlEqualTo(param.getWebUrl());
			}
			if(param.getSysName() != null){
				criteria.andSysNameEqualTo(param.getSysName());
			}
			if(param.getDescription() != null){
				criteria.andDescriptionEqualTo(param.getDescription());
			}
			if(param.getIconUrl() != null){
				criteria.andIconUrlEqualTo(param.getIconUrl());
			}
			if(param.getCreateTime() != 0){
				criteria.andCreateTimeEqualTo(param.getCreateTime());
			}
			if(param.getUpdateTime() != 0){
				criteria.andUpdateTimeEqualTo(param.getUpdateTime());
			}
			if (param.getOrder() != 0){
			}
			systemExample.setLimitStart((param.getPageIndex() - 1) * param.getPageSize());
			systemExample.setLimitEnd(param.getPageSize());
			List<System> systemList = systemMapper.selectByExample(systemExample);
			return systemList;
		}
		@Override
		public int countSystem(SystemSelectParam param){
			SystemExample systemExample = new SystemExample();
			systemExample.setOrderByClause("create_time desc");
			SystemExample.Criteria criteria = systemExample.createCriteria();
			if(param.getSysCode() != null){
				criteria.andSysCodeEqualTo(param.getSysCode());
			}
			if(param.getWebUrl() != null){
				criteria.andWebUrlEqualTo(param.getWebUrl());
			}
			if(param.getSysName() != null){
				criteria.andSysNameEqualTo(param.getSysName());
			}
			if(param.getDescription() != null){
				criteria.andDescriptionEqualTo(param.getDescription());
			}
			if(param.getIconUrl() != null){
				criteria.andIconUrlEqualTo(param.getIconUrl());
			}
			if(param.getCreateTime() != 0){
				criteria.andCreateTimeEqualTo(param.getCreateTime());
			}
			if(param.getUpdateTime() != 0){
				criteria.andUpdateTimeEqualTo(param.getUpdateTime());
			}
			if (param.getOrder() != 0){
			}
			systemExample.setLimitStart((param.getPageIndex() - 1) * param.getPageSize());
			systemExample.setLimitEnd(param.getPageSize());
			return systemMapper.countByExample(systemExample);
		}
}
